import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';





// 所有的路由定义，只有定义了，才可以打开界面
const routes: RouteRecordRaw[] = [
    // 一级路由
  {
    path: '/',
    component: () => import('@/layouts/admin.vue'),
    children: [
        // 二级路由
      {
        path: '/',
        meta: { title: '子首页' },
        component: () => import('@/views/pages/home.vue'),
      },
      {
        path: '/user',
        meta: { title: '子首页' },
        component: () => import('@/views/user/user.vue'),
      },
      {
        path: '/home',
        meta: { title: '子首页' },
        component: () => import('@/views/pages/home.vue'),
      },

    ],
  },
  {
    path: '/login',
    meta: { title: '登录页' },
    component: () => import('@/views/login/login.vue'),
  },
  {
    path: '/replace',
    meta: { title: '跳转中间页' },
    component: () => import('@/views/pages/replace/index.vue'),
  },
  {
    path: '/555',
    meta: { title: '555' },
    component: () => import('@/views/pages/555.vue'),
  },
  {
    path: '/gateway',
    meta: { title: '555' },
    component: () => import('@/views/pages/gateway.vue'),
  },
  {
    path: '/:pathMatch(.*)*',
    meta: { title: '404' },
    name: 'NotFound',
    component: () => import('@/views/pages/404.vue'),
  },
];

const router = createRouter({
  // 路由模式
  history: createWebHashHistory(),
  routes,
});

export default router;
